﻿<ResourceDictionary 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:SurveyControl_Controls="clr-namespace:SurveyControl.Controls" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
xmlns:System="clr-namespace:System;assembly=mscorlib" 
mc:Ignorable="d">
	<!-- Resource dictionary entries should be defined here. -->
	<ControlTemplate x:Key="NavigationPartControlTemplate" TargetType="SurveyControl_Controls:NavigationPart">
		<Grid d:DesignWidth="350" Background="{TemplateBinding Background}">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="auto"/>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="auto"/>
			</Grid.ColumnDefinitions>
			<VisualStateManager.VisualStateGroups>
				<VisualStateGroup x:Name="PreviousControl">
					<VisualState x:Name="PreviousEnable">
						<Storyboard>
							<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="PreviousButton">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<System:Boolean>True</System:Boolean>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
						</Storyboard>
					</VisualState>
					<VisualState x:Name="PreviousDisable">
						<Storyboard>
							<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="PreviousButton">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<System:Boolean>False</System:Boolean>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
						</Storyboard>
					</VisualState>
				</VisualStateGroup>
				<VisualStateGroup x:Name="NextControl">
					<VisualState x:Name="NextEnable">
						<Storyboard>
							<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="NextButton">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<System:Boolean>True</System:Boolean>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
						</Storyboard>
					</VisualState>
					<VisualState x:Name="NextDisable">
						<Storyboard>
							<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(Control.IsEnabled)" Storyboard.TargetName="NextButton">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<System:Boolean>False</System:Boolean>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
						</Storyboard>
					</VisualState>
				</VisualStateGroup>
				<VisualStateGroup x:Name="SubmitControl">
					<VisualState x:Name="SubmitEnable">
						<Storyboard>
							<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="SubmitButton">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<Visibility>Visible</Visibility>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
							<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="NextButton">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<Visibility>Collapsed</Visibility>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
						</Storyboard>
					</VisualState>
					<VisualState x:Name="SubmitDisable">
						<Storyboard>
							<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="SubmitButton">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<Visibility>Collapsed</Visibility>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
							<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="NextButton">
								<DiscreteObjectKeyFrame KeyTime="0">
									<DiscreteObjectKeyFrame.Value>
										<Visibility>Visible</Visibility>
									</DiscreteObjectKeyFrame.Value>
								</DiscreteObjectKeyFrame>
							</ObjectAnimationUsingKeyFrames>
						</Storyboard>
					</VisualState>
				</VisualStateGroup>
			</VisualStateManager.VisualStateGroups>
			<Button x:Name="PreviousButton" Margin="10" Height="25" Width="80" Content="{TemplateBinding PreviousContent}" IsEnabled="False"/>
			<Button x:Name="NextButton"     Margin="10" Height="25" Width="80" Content="{TemplateBinding NextContent}"     IsEnabled="False" Grid.Column="2"/>
			<Button x:Name="SubmitButton"   Margin="10" Height="25" Width="100" Content="{TemplateBinding SubmitContent}" Visibility="Collapsed" Grid.Column="2"/>
		</Grid>
	</ControlTemplate>
	
	<Style x:Key="NavigationPartStyle" TargetType="SurveyControl_Controls:NavigationPart">
		<Setter Property="Background" Value="LightCoral"/>
		<Setter Property="PreviousContent" Value="Previous"/>
		<Setter Property="NextContent" Value="Next"/>
		<Setter Property="SubmitContent" Value="Submit"/>
		<Setter Property="Template" Value="{StaticResource NavigationPartControlTemplate}"/>
	</Style>
	<ControlTemplate x:Key="QuestionControlTemplate" TargetType="SurveyControl_Controls:QuestionControl">
		<Grid Background="{TemplateBinding Background}" d:DesignHeight="250" d:DesignWidth="250">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" MinHeight="20"/>
				<RowDefinition/>
			</Grid.RowDefinitions>
			<ContentControl Content="{TemplateBinding Question}" d:LayoutOverrides="Width, Height" Margin="5"/>
			<ScrollViewer BorderBrush="Transparent" BorderThickness="0" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" TabNavigation="{TemplateBinding TabNavigation}" d:LayoutOverrides="Width" Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto">
				<ItemsPresenter/>
			</ScrollViewer>
		</Grid>
	</ControlTemplate>
	<Style x:Key="QuestionItemStyle" TargetType="ListBoxItem">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="ListBoxItem">
					<RadioButton 
						GroupName="" 
						Content="{TemplateBinding Content}" 
						x:Name="chkSelect" 
						HorizontalContentAlignment="Center" 
						HorizontalAlignment="Left" 
						VerticalAlignment="Top" 
						Margin="10,0,0,0"/>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
	<DataTemplate x:Key="QuestionControlItemTemplate">
		<CheckBox  Content="{Binding Label}" />
	</DataTemplate>
	<Style x:Key="QuestionControlStyle" TargetType="SurveyControl_Controls:QuestionControl">
		<Setter Property="Background" Value="LightBlue"/>
		<Setter Property="Template" Value="{StaticResource QuestionControlTemplate}"/>
		<Setter Property="ItemContainerStyle" Value="{StaticResource QuestionItemStyle}"/>
		<!--<Setter Property="ItemTemplate" Value="{StaticResource QuestionControlItemTemplate}"/>-->
	</Style>
	<ControlTemplate x:Key="SurveyControlTemplate" TargetType="SurveyControl_Controls:SurveyControl">
		<Grid Background="{TemplateBinding Background}" d:DesignWidth="250" d:DesignHeight="300">
			<Grid.RowDefinitions>
				<RowDefinition Height="auto"/>
				<RowDefinition Height="*"/>
				<RowDefinition Height="auto"/>
			</Grid.RowDefinitions>
			<ContentControl Grid.Row="0" Content="{TemplateBinding Header}"/>
			<ContentControl Grid.Row="1" Content="{TemplateBinding CurrentQuestion}" Background="#FF792E7A" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/>
			<SurveyControl_Controls:NavigationPart Grid.Row="2" Survey="{TemplateBinding Survey}" Style="{TemplateBinding NavigationStyle}"/>
		</Grid>
	</ControlTemplate>
	<Style x:Key="SurveyControlStyle" TargetType="SurveyControl_Controls:SurveyControl">
		<Setter Property="Background" Value="LightGray"/>
        <Setter Property="Template" Value="{StaticResource SurveyControlTemplate}"/>
        <Setter Property="NavigationStyle" Value="{StaticResource NavigationPartStyle}"/>
	</Style>
</ResourceDictionary>